package com.koron.css2.serviceManage.mapper;

import com.koron.css2.serviceManage.bean.CompanyAreaBean;
import com.koron.css2.serviceManage.bean.SelectBean;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CompanyAreaMapper {
	
	/**
	 * 查询列表
	 * 
	 * @return
	 */
	List<CompanyAreaBean> selectCompanyAreaList();
	
	/**
	 * 
	 * @param companyAreaBean
	 * @return
	 */
	CompanyAreaBean selectCompanyAreaById(@Param("companyAreaId") String companyAreaId);

	/**
	 * 添加
	 * 
	 * @param companyAreaBean
	 * @return
	 */
	void insertCompanyArea(CompanyAreaBean companyAreaBean);
	
	/**
	 * 校验字段内容重复
	 */
	@Select("select count(*) from PUB_COMPANY_AREA where ${key} = #{val}")
	Integer check(@Param("key") String key, @Param("val") String val);
	
	/**
	 * 校验字段内容重复-排除当前记录
	 */
	@Select("select count(*) from PUB_COMPANY_AREA where ${key} = #{val} and company_area_id <> #{id}")
	Integer check2(@Param("key") String key, @Param("val") String val, @Param("id") String id);
	
	
	/**
	 * 修改
	 * 
	 * @param companyAreaBean
	 * @return
	 */
	Integer updateCompanyArea(CompanyAreaBean companyAreaBean);
	
	/**
	 * 下拉框
	 * 
	 * @return
	 */
	List<SelectBean> selectComboBox();


}
